import { dialog } from '@gis/lib/components/antd-dialog/index.js';
import { h } from 'vue';
import { Button } from 'ant-design-vue';
import { openEventAddDialog } from '../../views/event-manage/event-opt.js';

export function addEvent(data) {
  openEventAddDialog(data);
}

export function openVideoListDialog(data = {}) {
  // dialog.hideAll();
  let videoDetails = {};
  dialog({
    content: () => import('./index.vue'),
    contentProps: {
      details: data,
      onVideoChange: (data) => {
        videoDetails = data;
      },
    },
    dialogProps: {
      width: 'large',
      height: 'fixed',
      footer: null,
      bodyStyle: { padding: 0 },
      title: h('div', { style: { display: 'flex', alignItems: 'center' } }, [
        h('span', {}, '查看视频'),
        h(
          Button,
          {
            style: { marginLeft: '10px' },
            onClick: () => addEvent(videoDetails),
          },
          '新增巡查事件'
        ),
      ]),
      // afterClose: () => dialog.showAll(),
    },
  });
}
